package newapproach.elements;

import java.lang.reflect.InvocationTargetException;

import newapproach.writer.XmlElement;

import org.dom4j.Element;

public abstract class YElement extends YBaseElement{

	public YElement(Element element) {
		super(element);
	}
	
	protected YElement newYElement(Element element) throws Exception {
		String name = element.getQualifiedName();
		if(name == null || name.startsWith("y_")){
			throw new Exception();
		}
		name = name.replaceFirst("y_", "");
		name = "Y"+Character.toUpperCase(name.charAt(0))+name.substring(1);
		return (YElement) Class.forName(name).getConstructor(Element.class).newInstance(element);
	}
	
	public abstract XmlElement toJsp();

	public abstract String toBean();
	
	
	
	

}
